package com.hotye.chkstyle;

//3.2.1 检测规则3  检查类和接口的注释 必包含作者与版本 -->
/**
 * 1.1 排版 测试代码
 * 
 *
 */
public class PaibanTest 
{

	private String test ;
	
    //检测规则1
    protected void testTab4()
    {
    	String testStr = "Hello World!";
       System.out.println(testStr);
       test = "test";
    }
    
    //检测规则2 左右大括号( "{" , "}" )各独自占一行
    public void testCurly()
    {
        int a = 3+5;
        //正确
        if(a==8)
        {
            
        }
        else
        {
            
        }
        
        //警告
        if(a==8){
            
        }else
        { 
            a=a+5;
        }
    }
    
    //检测规则3 每行长度不超过80个字符
    public void testLineLeng()
    {
        String testStr3 = "Hello Worlddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd!";
        System.out.println(testStr3);
        
        //超过指定字符换行，操作符在前，且缩进
        String aa = "Hello Worldddddddddddddddddddddddddddddd"+
            "dddddddddddddddddd";
        String bb = "Hello Worldddddddddddddddddddddddddddddd"
        +"dddddddddddddddddd";
        
        int[] a = new int[]{1,2,3};
        for (int c : a) 
        {
        	System.out.println(c);
        }
        
        for (int i=0;i<a.length;i++) 
        {
        	System.out.println(a[i]);
        }
        
    }
    
    //检测规则4  一句一行
    public void testPerLine()
    {
        Integer a =0; int b=1;
        a.toString(); 
    }
    
    //检测规则5 if,fo,do,while等语句的执行语句加{}
    public static void testNeedBraces()
    {
        int a = 1;
        if(a >= 0)
            System.out.println("a是正数");
    
        switch (a) 
        {
            case 1:
            {
                a = a +1;
            }
                break;
            case 2:
            	
            	break;

		default:
			a=0;
			break;
		}
        
        System.out.println(a);
    }
    
  //检测规则7 对等操作符前后加空格，关系密切操作符（如.)前后不加空格
    public void WhitespaceAround()
    {
        int a = 3 + 5;
        
      //关系密切操作符（如.)前后不加空格
        if (a == 5)
        {
            System. out. println(a);
        }
        
      //对等操作符前后加空格
        else 
        { 
            a*=2;
        }
    }
    
    //3.2.1检测规则4 变量上方注释 “/** */"
    private String test2 ; 
   
    //3.2.1检测规则4 公有和保护方法上方注释 “/** */"
    public void testJavadocMetho1()
    {
        String test1 = "Hello World!";
        System.out.println(test1); 
    }
    protected void testJavadocMethod2()
    {
        String test2 = "Hello World!";
        System.out.println(test2);
    }
    
  //3.2.1检测规则5 公有和保护方法注释内容 :参数 返回值 异常"
    /**
     * @param a 数字
     * @param b 字符
     * 
     */
    public static void testJavadocMethod3(int a, int b )
    {
        String test1 = "Hello World!";
        System.out.println(test1); 
    }
    
    protected void testJavadocMethod4(int a, int b)
    {
        String test2 = "Hello World!";
        System.out.println(test2);
    }
    
  //3.2.1检测规则8 对于switch下的case分支结束前加上break
    public static void FallThrough()
    {
        int a = 1;
        if(a >= 0)
            System.out.println("a是正数");
    
        switch (a) 
        {
            case 1:
            {
                a = a + 1;
            }
               //break;  
            case 2:

                break;

            default:
                a = 0;
                break;
        }
        
        System.out.println(a);
    }
    
    public static void Method_Name(int a, int b )
    {
        String test1 = "Hello World!";
        System.out.println(test1); 
    }
    
    public static final int MAX_VALUE = 1000;
}
